---
title: Maven
layout: page
pageOrder: 6
section: 'Where'
subsection: true
sitemap:
  priority: 0.6
  changefreq: 'monthly'
  lastmod: 2019-11-10T08:00:00+01:00
---

<h2>Maven Central &nbsp;&nbsp;<a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver"><img src="https://camo.githubusercontent.com/e81e59784109e88f76e25361cd6b4da7a5a18947/68747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f6f72672e6d6f636b2d7365727665722f6d6f636b7365727665722d6e657474792f62616467652e7376673f7374796c653d666c6174" alt="mockserver" data-canonical-src="https://maven-badges.herokuapp.com/maven-central/org.mock-server/mockserver-netty/badge.svg?style=flat" style="max-width:100%;"></a>
</h2>

<p>Maven Central contains the following released MockServer artifacts:</p>

<ul>
    <a id="mockserver_netty" class="anchor" href="#mockserver_netty">&nbsp;</a>
	<li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-netty">mockserver-netty</a> - a web server for mocking and proxying using Netty

        <p>Add to a maven build pom.xml as follows:</p>

<pre><code class="code xml">&lt;<span class="element">dependencies</span>&gt;
    ...
    &lt;<span class="element">dependency</span>&gt;
	    &lt;<span class="element">groupId</span>&gt;<span class="element_value">org.mock-server</span>&lt;/<span class="element">groupId</span>&gt;
	    &lt;<span class="element">artifactId</span>&gt;<span class="element_value">mockserver-netty-no-dependencies</span>&lt;/<span class="element">artifactId</span>&gt;
	    &lt;<span class="element">version</span>&gt;<span class="element_value">RELEASE</span>&lt;/<span class="element">version</span>&gt;
    &lt;/<span class="element">dependency</span>&gt;
    ...
&lt;<span class="element">dependencies</span>&gt;</code></pre>

        <p>Add to a gradle build build.gradle as follows:</p>

<pre><code class="code"><span class="final">dependencies</span> {
    ...
    <span class="final">testImplementation</span>(<span class="string_literal">"org.mock-server:mockserver-netty-no-dependencies:{{ site.mockserver_version }}"</span>)
    ...
}</code></pre>

        <p>The following versions are available for <strong>mockserver-netty</strong> in Maven Central.  These dependencies work for Maven, Gradle, Scala SBT, Apache Ivy, etc</p>

        <ul>
            <li><strong>org.mock-server:mockserver-netty-no-dependencies:{{ site.mockserver_version }}</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  This has no transitive dependencies and so is the recommended best option.</li>
            <li><strong>org.mock-server:mockserver-netty:{{ site.mockserver_version }}</strong> - only compiled code with transitive dependencies pulled in by Maven, Gradle, etc.  As per normal Maven or Ivy dependencies this includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.</li>
            <li><strong>org.mock-server:mockserver-netty:{{ site.mockserver_version }}:shaded</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-netty-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
            <li><strong>org.mock-server:mockserver-netty:{{ site.mockserver_version }}:jar-with-dependencies</strong> - compiled code and transitive dependencies bundled into a single jar.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-netty-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
        </ul>

    </li>

	<li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-war">mockserver-war</a> - a deployable WAR for mocking that can be deployed to any JEE web server, this artifact
		<a target="_blank" href="https://search.maven.org/remotecontent?filepath=org/mock-server/mockserver-war/{{ site.mockserver_version }}/mockserver-war-{{ site.mockserver_version }}.war">can be downloaded</a>.
	</li>

	<li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-proxy-war">mockserver-proxy-war</a> - a deployable WAR for proxying that can be deployed to any JEE web server, this artifact
		<a target="_blank" href="https://search.maven.org/remotecontent?filepath=org/mock-server/mockserver-proxy-war/{{ site.mockserver_version }}/mockserver-proxy-war-{{ site.mockserver_version }}.war">can be downloaded</a>.
	</li>

	<li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-maven-plugin">mockserver-maven-plugin</a> - a set of maven plugins to start, stop and fork MockServer using maven

    <p>Add to a maven build pom.xml as follows:</p>

<pre><code class="code xml">&lt;<span class="element">plugin</span>&gt;
    &lt;<span class="element">groupId</span>&gt;<span class="element_value">org.mock-server</span>&lt;/<span class="element">groupId</span>&gt;
    &lt;<span class="element">artifactId</span>&gt;<span class="element_value">mockserver-maven-plugin</span>&lt;/<span class="element">artifactId</span>&gt;
    &lt;<span class="element">version</span>&gt;<span class="element_value">RELEASE</span>&lt;/<span class="element">version</span>&gt;
    &lt;<span class="element">configuration</span>&gt;
        &lt;<span class="element">serverPort</span>&gt;<span class="element_value">1080</span>&lt;/<span class="element">serverPort</span>&gt;
        &lt;<span class="element">pipeLogToConsole</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">pipeLogToConsole</span>&gt;
    &lt;/<span class="element">configuration</span>&gt;
&lt;/<span class="element">plugin</span>&gt;</code></pre>
        <a id="mockserver_client_java" class="anchor" href="#mockserver_client_java">&nbsp;</a>
	<li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-client-java">mockserver-client-java</a> - a Java client to communicate with both the server and the proxy

    <p>Add to a maven build pom.xml as follows:</p>

<pre><code class="code xml">&lt;<span class="element">dependency</span>&gt;
	&lt;<span class="element">groupId</span>&gt;<span class="element_value">org.mock-server</span>&lt;/<span class="element">groupId</span>&gt;
	&lt;<span class="element">artifactId</span>&gt;<span class="element_value">mockserver-client-java-no-dependencies</span>&lt;/<span class="element">artifactId</span>&gt;
	&lt;<span class="element">version</span>&gt;<span class="element_value">RELEASE</span>&lt;/<span class="element">version</span>&gt;
&lt;/<span class="element">dependency</span>&gt;</code></pre>

    <p>Add to a gradle build build.gradle as follows:</p>

<pre><code class="code"><span class="final">dependencies</span> {
    ...
    <span class="final">testImplementation</span>(<span class="string_literal">"org.mock-server:mockserver-client-java-no-dependencies:{{ site.mockserver_version }}"</span>)
    ...
}</code></pre>

    <p>The following versions are available for the Java client in Maven Central.  These dependencies work for Maven, Gradle, Scala SBT, Apache Ivy, etc</p>

    <ul>
        <li><strong>org.mock-server:mockserver-client-java-no-dependencies:{{ site.mockserver_version }}</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  This has no transitive dependencies and so is the recommended best option.</li>
        <li><strong>org.mock-server:mockserver-client-java:{{ site.mockserver_version }}</strong> - only compiled code with transitive dependencies pulled in by Maven, Gradle, etc.  As per normal Maven or Ivy dependencies this includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.</li>
        <li><strong>org.mock-server:mockserver-client-java:{{ site.mockserver_version }}:shaded</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-client-java-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
        <li><strong>org.mock-server:mockserver-client-java:{{ site.mockserver_version }}:jar-with-dependencies</strong> - compiled code and transitive dependencies bundled into a single jar.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-client-java-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
    </ul>

</li>

    <li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-junit-rule">mockserver-junit-rule</a> - a <a href="/mock_server/running_mock_server.html#junit_rule">Junit 4 @Rule</a> that starts MockServer (<strong>for both mocking and proxying</strong>) on a free port before the any test runs and stops MockServer after all tests have completed.

        <p>The following versions are available for <strong>mockserver-junit-rule</strong> in Maven Central.  These dependencies work for Maven, Gradle, Scala SBT, Apache Ivy, etc</p>

        <ul>
            <li><strong>org.mock-server:mockserver-junit-rule-no-dependencies:{{ site.mockserver_version }}</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  This has no transitive dependencies and so is the recommended best option.</li>
            <li><strong>org.mock-server:mockserver-junit-rule:{{ site.mockserver_version }}</strong> - only compiled code with transitive dependencies pulled in by Maven, Gradle, etc.  As per normal Maven or Ivy dependencies this includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.</li>
            <li><strong>org.mock-server:mockserver-junit-rule:{{ site.mockserver_version }}:shaded</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-junit-rule-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
            <li><strong>org.mock-server:mockserver-junit-rule:{{ site.mockserver_version }}:jar-with-dependencies</strong> - compiled code and transitive dependencies bundled into a single jar.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-junit-rule-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
        </ul>

    </li>

    <li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-junit-jupiter">mockserver-junit-jupiter</a> - a <a href="/mock_server/running_mock_server.html#junit_rule">Junit 5 Test Extension</a> that starts MockServer (<strong>for both mocking and proxying</strong>) on a free port before the any test runs and stops MockServer after all tests have completed.

        <p>The following versions are available for <strong>mockserver-junit-jupiter</strong> in Maven Central.  These dependencies work for Maven, Gradle, Scala SBT, Apache Ivy, etc</p>

        <ul>
            <li><strong>org.mock-server:mockserver-junit-jupiter-no-dependencies:{{ site.mockserver_version }}</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  This has no transitive dependencies and so is the recommended best option.</li>
            <li><strong>org.mock-server:mockserver-junit-jupiter:{{ site.mockserver_version }}</strong> - only compiled code with transitive dependencies pulled in by Maven, Gradle, etc.  As per normal Maven or Ivy dependencies this includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.</li>
            <li><strong>org.mock-server:mockserver-junit-jupiter:{{ site.mockserver_version }}:shaded</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-junit-jupiter-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
            <li><strong>org.mock-server:mockserver-junit-jupiter:{{ site.mockserver_version }}:jar-with-dependencies</strong> - compiled code and transitive dependencies bundled into a single jar.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-junit-jupiter-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
        </ul>

    </li>

    <li><a target="_blank" href="https://search.maven.org/artifact/org.mock-server/mockserver-spring-test-listener">mockserver-spring-test-listener</a> - a <a href="/mock_server/running_mock_server.html#spring_test_exec_listener">Spring Test Execution Listener</a> that starts MockServer (<strong>for both mocking and proxying</strong>) for writing mockserver tests in spring projects

        <p>The following versions are available for <strong>mockserver-spring-test-listener</strong> in Maven Central.  These dependencies work for Maven, Gradle, Scala SBT, Apache Ivy, etc</p>

        <ul>
            <li><strong>org.mock-server:mockserver-spring-test-listener-no-dependencies:{{ site.mockserver_version }}</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  This has no transitive dependencies and so is the recommended best option.</li>
            <li><strong>org.mock-server:mockserver-spring-test-listener:{{ site.mockserver_version }}</strong> - only compiled code with transitive dependencies pulled in by Maven, Gradle, etc.  As per normal Maven or Ivy dependencies this includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.</li>
            <li><strong>org.mock-server:mockserver-spring-test-listener:{{ site.mockserver_version }}:shaded</strong> - compiled code and transitive dependencies bundled into a single jar, with packages for most transitive dependencies being updated to avoid clashes with dependencies from projects importing MockServer.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-spring-test-listener-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
            <li><strong>org.mock-server:mockserver-spring-test-listener:{{ site.mockserver_version }}:jar-with-dependencies</strong> - compiled code and transitive dependencies bundled into a single jar.  Because classifiers all use the same pom.xml this library still includes transitive dependencies (in its pom.xml) which would be pulled in by Maven, Gradle, Ivy, SBT, etc unless explicitly excluded.  Use the <strong>org.mock-server:mockserver-spring-test-listener-no-dependencies:{{ site.mockserver_version }}</strong> dependencies to avoid the transitive dependencies.</li>
        </ul>

    </li>
</ul>

<a id="sonatype_snapshot" class="anchor" href="#sonatype_snapshot">&nbsp;</a>

<h2>Sonatype SNAPSHOT</h2>

<p>The latest SNAPSHOT version can be found at <a target="_blank" href="https://oss.sonatype.org/content/repositories/snapshots/org/mock-server/">Sonatype</a></p>

<h3>Maven</h3>

<p>To use the SNAPSHOT version in a maven project you need to configure your maven <strong>settings.xml</strong> or your <strong>pom.xml</strong> to include the Sonatype SNAPSHOT repository as follows:</p>

<pre><code class="code xml">&lt;<span class="element">profile</span>&gt;
    &lt;<span class="element">id</span>&gt;<span class="element_value">sonatype</span>&lt;/<span class="element">id</span>&gt;
    &lt;<span class="element">activation</span>&gt;
        &lt;<span class="element">activeByDefault</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">activeByDefault</span>&gt;
    &lt;/<span class="element">activation</span>&gt;
    &lt;<span class="element">repositories</span>&gt;
        &lt;<span class="element">repository</span>&gt;
            &lt;<span class="element">id</span>&gt;<span class="element_value">sonatype-nexus-snapshots</span>&lt;/<span class="element">id</span>&gt;
            &lt;<span class="element">name</span>&gt;<span class="element_value">sonatype-nexus-snapshots</span>&lt;/<span class="element">name</span>&gt;
            &lt;<span class="element">url</span>&gt;<span class="element_value">https://oss.sonatype.org/content/repositories/snapshots</span>&lt;/<span class="element">url</span>&gt;
            &lt;<span class="element">layout</span>&gt;<span class="element_value">default</span>&lt;/<span class="element">layout</span>&gt;
            &lt;<span class="element">releases</span>&gt;
                &lt;<span class="element">enabled</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">enabled</span>&gt;
            &lt;/<span class="element">releases</span>&gt;
            &lt;<span class="element">snapshots</span>&gt;
                &lt;<span class="element">enabled</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">enabled</span>&gt;
            &lt;/<span class="element">snapshots</span>&gt;
        &lt;/<span class="element">repository</span>&gt;
    &lt;/<span class="element">repositories</span>&gt;
    &lt;<span class="element">pluginRepositories</span>&gt;
        &lt;<span class="element">pluginRepository</span>&gt;
            &lt;<span class="element">id</span>&gt;<span class="element_value">sonatype-nexus-snapshots</span>&lt;/<span class="element">id</span>&gt;
            &lt;<span class="element">name</span>&gt;<span class="element_value">sonatype-nexus-snapshots</span>&lt;/<span class="element">name</span>&gt;
            &lt;<span class="element">url</span>&gt;<span class="element_value">https://oss.sonatype.org/content/repositories/snapshots</span>&lt;/<span class="element">url</span>&gt;
            &lt;<span class="element">layout</span>&gt;<span class="element_value">default</span>&lt;/<span class="element">layout</span>&gt;
            &lt;<span class="element">releases</span>&gt;
                &lt;<span class="element">enabled</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">enabled</span>&gt;
            &lt;/<span class="element">releases</span>&gt;
            &lt;<span class="element">snapshots</span>&gt;
                &lt;<span class="element">enabled</span>&gt;<span class="element_value">true</span>&lt;/<span class="element">enabled</span>&gt;
            &lt;/<span class="element">snapshots</span>&gt;
        &lt;/<span class="element">pluginRepository</span>&gt;
    &lt;/<span class="element">pluginRepositories</span>&gt;
&lt;/<span class="element">profile</span>&gt;</code></pre>

<p><strong>Note:</strong> typically it is best practice to configure the <strong>~/.m2/settings.xml</strong> file instead of the <strong>settings.xml</strong> file located inside the <strong>conf</strong> directory in the maven installation directory (i.e. <strong>$M2_HOME</strong>). This is because the
	<strong>~/.m2/settings.xml</strong> file will be consistent between maven version upgrades and any changes to this file will only affect a single user.</p>

<p>Once the Sonatype SNAPSHOT repository has been added, as above, the latest SNAPSHOT build can referenced.</p><p>For example add a dependency on the latest SNAPSHOT build for <strong>mockserver-netty</strong>, as follows:</p>

<pre><code class="code xml">&lt;<span class="element">dependency</span>&gt;
	&lt;<span class="element">groupId</span>&gt;<span class="element_value">org.mock-server</span>&lt;/<span class="element">groupId</span>&gt;
	&lt;<span class="element">artifactId</span>&gt;<span class="element_value">mockserver-netty</span>&lt;/<span class="element">artifactId</span>&gt;
	&lt;<span class="element">version</span>&gt;<span class="element_value">SNAPSHOT</span>&lt;/<span class="element">version</span>&gt;
	&lt;<span class="element">classifier</span>&gt;<span class="element_value">shaded</span>&lt;/<span class="element">classifier</span>&gt;
&lt;/<span class="element">dependency</span>&gt;</code></pre>

<h3>Gradle</h3>

<p>To use the SNAPSHOT version in a gradle project you need to add the correct repository into the project as follows:</p>

<pre><code class="code"><span class="final">repositories</span> {
    ...
    <span class="final">maven</span> { <span class="final">url</span> <span class="string_literal">"https://oss.sonatype.org/content/repositories/snapshots"</span> }
    ...
}</code></pre>

<p>Once the Sonatype SNAPSHOT repository has been added, the latest SNAPSHOT build can referenced, as follows:</p>

<pre><code class="code"><span class="final">dependencies</span> {
    ...
    <span class="final">testImplementation</span>(<span class="string_literal">"org.mock-server:mockserver-netty:{{ site.mockserver_snapshot_version }}"</span>)
    ...
}</code></pre>
